﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Threading;
using VoDA.FtpServer;

namespace Kang.ExtendMethod.Ftp
{
    public class SimpleFtpServer
    {
        FtpServerBuilder server;

        public static SimpleFtpServer Create()
        {
            return new SimpleFtpServer();
        }

        public SimpleFtpServer()
        {
            server = new FtpServerBuilder();
        }

        public void Start()
        {
        }

        public void Stop()
        {
        }

        public SimpleFtpServer AddAnonymous(string homePath)
        {
            server.Authorization((config) =>
            {
                config.UseAuthorization = true;
                config.UsernameVerification += (homePath, username) => {
                    return "anonymous".Equals(username) || "Anonymous".Equals(username);
                };
            }).FileSystem((fs) =>
            {
            });
            return this;
        }

        public SimpleFtpServer DelAnonymous(string homePath)
        {
            return this;
        }

        public SimpleFtpServer AddUser(string homePath, string un, string pw)
        {
            return this;
        }

        public SimpleFtpServer DelUser()
        {
            return this;
        }
    }
}
